package com.d3works.apps.crm.web;

import com.d3works.apps.base.db.ICalendarUser;
import com.d3works.apps.base.ical.ICalendarService;
import com.d3works.auth.db.User;
import com.d3works.inject.Beans;
import com.d3works.meta.CallMethod;

public class ICalendarUserController {

  @CallMethod
  public ICalendarUser findUser(User user) {
    if (user != null && user.getiCalendar() != null && user.getiCalendar().getUser() != null) {
      return Beans.get(ICalendarService.class).findOrCreateUser(user);
    }
    return null;
  }
}
